<!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        萌宠资讯
        <small>Control panel</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 控制台</a></li>
        <li class="active">萌宠资讯</li>
      </ol>
    </section>



    <!-- Main content -->
    <section class="content">

      <div class="row">
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">Advertising  Table</h3>

              <div class="box-tools">
                <!--<a href="{:url('admin/informatioi/add')}" class="btn btn-info pull-right">添加资讯</a>-->
                <button type="button" class="btn btn-info pull-right" data-toggle="modal" data-target="#myModal">
                  添加品种
                </button>
              </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding">
              <form action="{:url('admin/informatioi/delall')}" method="post">
              <table class="table table-hover">
                <tbody><tr>
                  <th class="text-center" width="100"><input type="checkbox" value="" id="checkall" class=""> 全选</th>
                  <th>ID</th>
                  <th>图片</th>
                  <th>简介</th>
                  <th>时间</th>
                  <th>作者</th>
                  <th style="width: 15%">操作</th>
                </tr>

                <?php foreach($informatioi as $v): ?>
                <tr>
                  <td class="text-center"><input type="checkbox" value="<?php echo $v['i_id']; ?>" name="idarr[]" class="cbox"></td>
                  <td><?php echo $v['i_id'] ?></td>
                  <td><img src="<?php echo thumb($v['i_img'], 300, 150); ?>" alt=""></td>
                  <td><?php echo $v['i_title'] ?></td>
                  <td><?php echo date('Y-m-d H:i:s',$v['i_time']);  ?></td>
                  <td><?php echo $v['author'] ?></td>
                  <td>
                    <a href="{:url('admin/informatioi/edit',['id'=>$v['i_id']])}"><button type="button" class="btn btn-sm btn-primary glyphicon glyphicon-pencil">  修改</button></a>
                    <a href="{:url('admin/informatioi/del',['id'=>$v['i_id']])}"><button type="button" class="btn  btn-sm btn-danger glyphicon glyphicon-trash">  删除</button></a>
                  </td>
                </tr>
                <?php endforeach; ?>

                </tbody></table>
              <div class="pull-left" style="margin: 20px;">
                <button type="submit" class="btn btn-default btn-gradient pull-right delall"><span class="glyphicon
glyphicon-trash"></span></button>
              </div>
              </form>
            </div>
            {$informatioi|raw}
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
      </div>


    </section>
    <!-- /.content -->
  </div>
<!-- Modal -->
<div class="modal fade bs-example-modal-lg" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">


      <div class="row">
        <div class="col-md-12">
          <!-- Horizontal Form -->

          <div class="box-header with-border">
            <h3 class="box-title">添加资讯</h3>
          </div>
          <!-- /.box-header -->
          <!-- form start -->
          <form action="{:url('admin/informatioi/add')}" method="post"  enctype="multipart/form-data" class="form-horizontal">

            <div class="row text-center">
              <div class="col-lg-12" id="preview">
                <img id="imghead" border="0" src="__ADMINMY__/photo_icon.png" width="150" height="150" onclick="$('#previewImg').click();">
                <label for="" style="margin-right: 20px;">上传图片</label>
              </div>
              <input type="file" name="image" onchange="previewImage(this,300,250)" style="display: none;" id="previewImg">
            </div>

            <div class="box-body">

              <div class="form-group">
                <label for="i_title" class="col-sm-2 control-label">简介</label>

                <div class="col-sm-9">
                  <input type="text" class="form-control" name="i_title" id="i_title">
                  <p id="b_link_mes"  style="color: red;line-height: 34px;font-size: 12px;margin: 0;padding: 0;height: 12px;"></p>
                </div>
              </div>
              <div class="form-group">
                <label for="author" class="col-sm-2 control-label">作者</label>

                <div class="col-sm-9">
                  <input type="text" class="form-control" name="author" id="author">
                  <p id="v_name_mes"  style="color: red;line-height: 34px;font-size: 12px;margin: 0;padding: 0;height: 12px;"></p>
                </div>
              </div>
              <div class="form-group">
                <label for="content" class="col-sm-2 control-label">内容</label>

                <div class="col-sm-9">

                  <!-- 加载编辑器的容器 -->
                  <script id="container" name="i_content" type="text/plain">

                  </script>
                  <!-- 配置文件 -->
                  <script type="text/javascript" src="__UEDITOR__ueditor.config.js"></script>
                  <!-- 编辑器源码文件 -->
                  <script type="text/javascript" src="__UEDITOR__ueditor.all.js"></script>
                  <!-- 实例化编辑器 -->
                  <script type="text/javascript">
                      var ue = UE.getEditor('container');
                  </script>

                </div>
              </div>

            </div>
            <!-- /.box-body -->
            <div class="box-footer">
              <div class="col-sm-2">
                <button type="reset" class="btn btn-default">重置</button>
              </div>

              <div class="col-sm-9">
                <button type="submit" class="btn btn-info pull-right">提交</button>
              </div>

            </div>
            <!-- /.box-footer -->
          </form>

          <!-- /.box -->
        </div>
        <!--/.col (right) -->
      </div>

    </div>
  </div>
</div>

<script>
    $("#i_title").blur(function(){
        if($(this).val()==0){
            $("#b_link_mes").html('*请填写简介');
            return false;
        }

    });
    $("#i_title").focus(function(){
        $("#b_link_mes").html('');
    });

    $("#author").blur(function(){
        if($(this).val()==0){
            $("#v_name_mes").html('*请填写作者');
            return false;
        }

    });
    $("#author").focus(function(){
        $("#v_name_mes").html('');
    });

</script>